package com.t3.tuio
{
	import com.t3.fx.DraggableObject;
	
	public class TUIOCursor extends TUIOPoint
	{
		protected var _object:DraggableObject;
		
		public function TUIOCursor( event:TUIOEvent, object:DraggableObject = null ):void
		{
			super( event );
			trace("cursor");
			if( object != null )
			{
				this._object = object.startDragging( this );
			}
		}
		
		public override function update( event:TUIOEvent, ignoreEvent:Boolean = false ):void
		{	
			if( ignoreEvent || event.s_id == this.s_id && ( event.x != _x || event.y != _y ) )
			{
				super.update( event );
				
				if( this is TUIOPoint )
				{
					event.data.point = this;
					this.dispatchEvent( new TUIOEvent( TUIOEvent.CURSOR_MOVED, event.data ) );
				}
			}
		}
		
		public function get object():DraggableObject
		{
			return _object;
		}
		
		public function remove():void
		{			
			dispatchEvent( new TUIOEvent( TUIOEvent.REMOVE_TUIO_CUR ) );
		}
	}
}